<script setup lang='ts'>
import { ref } from 'vue'
import { getLocalImageUrl } from '@/hooks/useImportImage'
import TemplateList from '@/components/TemplateList.vue'
import Header from '@/components/common/Header.vue'
import Footer from '@/components/common/Footer.vue'

const searchText = ref('')
const SearchTemplate = (searchValue: string) => {
    console.log(searchValue)
}
const featureBannerArr = ref([
    { img: getLocalImageUrl('/src/assets/img/1.svg'), title: '专注H5时钟如一', text: '三年保持行业领先' },
    { img: getLocalImageUrl('/src/assets/img/2.svg'), title: '海量H5模板', text: '一键生成，一分钟轻松制作' },
    { img: getLocalImageUrl('/src/assets/img/3.svg'), title: '极致体验', text: '用户的一致选择' },
])
</script>

<template>
    <a-layout>
        <Header :isTransparent="true"></Header>
        <a-layout-content>
            <div class="search-wrapper">
                <div class="search-title">海量精彩设计 一键生成</div>
                <div class="search">
                    <a-input-search v-model:value="searchText" bordered size="large" placeholder="搜索一下，快速找模板" enter-button
                        @search="SearchTemplate" />
                </div>
            </div>
            <div class="feature">
                <div class="feature-item" v-for="item in featureBannerArr">
                    <img :src="item.img" alt="" srcset="">
                    <div class="title">{{ item.title }}</div>
                    <div class="text">{{ item.text }}</div>
                </div>
            </div>
            <div class="template-list-container">
                <div class="title-wrapper">
                    <div class="title">———
                        <div class="title-text">
                            热门海报
                        </div>
                        ———
                    </div>
                    <div class="text">只需替换文字和图片，一键自动生成H5</div>
                </div>
                <div class="list-wrapper">
                    <TemplateList></TemplateList>
                </div>
            </div>
        </a-layout-content>
        <Footer></Footer>
    </a-layout>
</template>

<style scoped lang='scss'>
@import '../assets/styles/mixin.scss';

.ant-layout-content {
    .search-wrapper {
        background-image: url('@/assets/img/home-background.png');
        background-position: center;
        height: 450px;
        @include displayCenter();
        flex-direction: column;

        .search-title {
            color: #fff;
            font-size: 32px;
            font-weight: 600;
        }

        .search {
            margin-top: 20px;
            width: 40%;

            .ant-input-search {
                :deep(.ant-input) {
                    border-radius: 20px 0 0 20px;
                }

                :deep(.ant-input-group-addon) {
                    border-radius: 0 20px 20px 0;

                }

                :deep(.ant-btn) {
                    border-radius: 0 20px 20px 0;
                }
            }
        }

    }

    .feature {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 200px;
        @include boxWidth();

        .feature-item {
            @include displayCenter();
            flex-direction: column;

            img {
                width: 65px;
                margin-bottom: 10px;
            }

            .title {
                font-size: 20px;
            }

            .text {
                color: #666;
            }
        }
    }

    .template-list-container {
        background-color: #fff;

        .title-wrapper {
            padding-top: 40px;
            @include displayCenter();
            flex-direction: column;

            .title {
                display: flex;
                color: #999;
                line-height: 18px;

                .title-text {
                    color: #000000;
                    font-size: 18px;
                }
            }

            .text {
                margin-top: 10px;
                color: #666;
            }
        }

        .list-wrapper {
            @include boxWidth();
        }
    }
}
</style>